package org.dromara.module.service;

import com.baomidou.mybatisplus.extension.service.IService;
import org.dromara.common.core.exception.TransactionalException;
import org.dromara.module.domain.WxUser;

import java.util.Date;
import java.util.List;

/**
 * 小程序用户Service接口
 *
 * @author Lion Li
 * @date 2025-04-01
 */
public interface IWxUserService extends IService<WxUser>{

    /**
     * 微信绑定手机号
     *
     * @param phone
     * @param user
     * @param platform
     * @return
     * @throws TransactionalException
     */
    int bandPhone(String phone, WxUser user, String platform) throws TransactionalException;

    int unBandPhone(String phone, WxUser user) throws TransactionalException;

    List<WxUser> selectByShopId(Integer shop_id, Integer user_id, Integer offset, Integer pageSize, Date begin_time, Date end_time);

    /**
     * 新用户注册
     *
     * @param openId
     * @param unionId
     * @param sessionKey
     * @param token
     * @param platform
     * @param lng
     * @param lat
     * @param from_type  为了记录注册的来源  抽奖可以多添加一次抽奖机会
     * @param userType
     * @return
     * @throws TransactionalException
     */
    WxUser register(String openId, String unionId, String sessionKey, String token,
                    String platform, double lng, double lat, String from_type, Integer userType) throws TransactionalException;

    int updateLogin(WxUser user)throws TransactionalException;

}
